<?php
	require_once("web_fns.php");
	if (!session_id()) session_start();
	if(!isset($_SESSION['user_id'])) {
		echo 2;
	}
	else {
		$car_id = $_POST['car_id'];
		$collect_type = $_POST['collect_type'];
		//收藏函数
		if($collect_type==0) {
			$check_collect=collect_car($car_id,$users_info,$_SESSION['user_id']);
			switch($check_collect) {
				case "0":
					echo 0;
					break;
				case "1":
					echo 1;
					break;
				default:;
			}
		}
		//取消收藏
		else {
			$check_collect=collect_remove($car_id,$users_info,$_SESSION['user_id']);
			switch($check_collect) {
				case "0":
					echo 0;
					break;
				case "1":
					echo 1;
					break;
				default:;
			}
		}
	}
?>